<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var data=[
            {
                id:1,
                name:"小米",
                age:24,
                gender:'男'
            },
            {
                id: 2,
                name: '小芳',
                age: 30,
                gender: '女'
            },
            {
                id: 3,
                name: '小美',
                age: 31,
                gender: '女'
            },
            {
                id: 4,
                name: '小刚',
                age: 21,
                gender: '男'
            },
            {
                id: 5,
                name: '小琪',
                age: 18,
                gender: '女'
            }
        ]
            // 年龄大于20岁 且是女生；

        // var res=data.filter(function(item){
        //     return item.age>20;
        // }).filter(function(item){
        //     return item.gender==='女';
        // })


        var res=data.filter(item=>item.age>20).filter(item=>item.gender==='女');
        // console.log(res);

        //20岁以下的女生
        var rest=data.filter(item=>item.age<20).filter(item=>item.gender==='女');
        // console.log(rest);

        var resnan=data.filter(item=>item.gender==='男');
        console.log(resnan);





        // var fn=(...arg)=>{
        //     console.log(arg);
        // }

        // fn(1,2,3)

    </script>
</body>
</html>